home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Essential Home & Business Collection
/
The Essential Home & Business Collection.iso
/
27
/
3
/
5
/
HP22D5.ZIP
/
EXTERN
/
TESTASM.ASM
< prev
next >
Wrap
Assembly Source File
|
1991-04-16
|
1KB
|
73 lines
DOSSEG
.MODEL LARGE
include extern.inc
extrn _printf:far
.DATA
SampleName db 'sample',0
Pool PoolStruct <SampleName,SampleProc,,HANDLER>
PoolStruct <> ;END
formatstr db '%s',13,10,0
.CODE
WhenLoaded proc far
ret
WhenLoaded endp
WhenUnLoaded proc far
ret
WhenUnLoaded endp
;
; SampleProc: This routine prints out all of the arguments that
; you pass to it. It may mess up the screen, but this doesn't hurt
; anything. To call the handler from HyperPAD:
;
; handler select;
; begin
; sample "hello","world",1,2,3;
; end;
;
SampleProc proc far
push bp
mov bp,sp
;check number of arguments
mov cx,[bp+6] ;CX = NumArgs
jcxz SP_END ;exit if no args
push di ;save DI, use as counter
mov di,cx ;DI = NumArgs
add bp,8 ;BP = next argument
SP_TOP:
les bx,[bp] ;ES:BX = hdl
les bx,es:[bx] ;ES:BX = *hdl
push es
push bx ;pass pointer to string
push ds ;segment of format string
mov ax,offset formatstr
push ax ;AX = offset of format string
call _printf
add sp,8 ;cleanup stack after C call
add bp,4
dec di
jnz SP_TOP ;loop until no more args
pop di
SP_END:
mov ax,STOP ;don't pass on
pop bp
ret
SampleProc endp
END